package net.lzzy.practices.web.models;

import lombok.Getter;
import lombok.Setter;
import net.lzzy.practices.entities.Option;

import java.util.UUID;

/**
 * @author zly on 2022/6/1
 * Description:
 */
@Getter
@Setter
public class VmOption {
    private UUID id;
    private  String content;
    private  String label;
    private  Boolean answer;
    private  UUID questionId;

    private   VmOption(){}

    public  static  VmOption create(Option option,boolean teacher){
        VmOption vm = new VmOption();
        vm.setId(option.getId());
        vm.setAnswer(teacher ? option.isAnswer():null);
        vm.setContent(option.getLabel());
        vm.setQuestionId(option.getQuestion().getId());
        return  vm;
    }
}
